﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace EmbeddedLanguage
{
    public static class MemberInfoEx
    {
        public static T GetAttribute<T>(this MemberInfo mi) where T : Attribute
        {
            var attribs = mi.GetCustomAttributes(typeof(T), true);
            if (attribs == null || attribs.Length == 0) return default(T);
            return attribs[0] as T;
        }
    }
}
